<layout name="Public/layout"/>
{:jumps($infos['authority'],CONTROLLER_NAME)}

        <!--主要区域开始-->
        <div id="main">            

            <form action="__SELF__" method="post" class="main_form">
                
                <div class="text_info clearfix"><span>权限ID：</span></div>
                <div class="input_info">
                    <input type="text" class="width200" value='{$res.id}' disabled/>
                    <input type="hidden" class="width200" name='id' value='{$res.id}'/>
                    <span class="required">*</span>
                    <div class="validate_msg_medium">权限ID，且不能更改</div>
                </div> 
                
                <div class="text_info clearfix"><span>权限名称：</span></div>
                <div class="input_info">
                    <input type="text" class="width200" name='name' value='{$res.name}'/>
                    <span class="required">*</span>
                    <div class="validate_msg_medium">不能为空，且为20长度的字母、数字和汉字的组合</div>
                </div> 
                
                <div class="text_info clearfix"><span>控制器：</span></div>
                <div class="input_info">
                    <input type="text" class="width200" name='controller' value='{$res.controller}'/>
                    <span class="required">*</span>
                    <div class="validate_msg_medium">不能为空，20长度以内的字母、数字和下划线的组合</div>
                </div>   
                
                <div class="text_info clearfix"><span>模型：</span></div>
                <div class="input_info">
                    <input type="text" class="width200" name='module' value='{$res.module}'/>
                    <span class="required">*</span>
                    <div class="validate_msg_medium">不能为空，20长度以内的字母、数字和下划线的组合</div>
                </div>    
                
                <div class="text_info clearfix"><span>方法：</span></div>
                <div class="input_info_high">
                    <div class="input_info_scroll">
                        <ul>
                            <li><input type="checkbox" name='action[]' value='index'
                            <php>
                                if( strstr( $res['action'],'index' ) ){
                                    echo 'checked';
                                }
                            </php>
                                       />查看权限</li>
                            
                            <li><input type="checkbox" name='action[]' value='add'
                            <php>
                                if( strstr( $res['action'],'add' ) ){
                                    echo 'checked';
                                }
                            </php>                                       
                                       />添加权限</li>
                            
                            <li><input type="checkbox" name='action[]' value='edit'
                            <php>
                                if( strstr( $res['action'],'edit' ) ){
                                    echo 'checked';
                                }
                            </php>                                         
                                       />修改权限</li>
                            
                            <li><input type="checkbox" name='action[]' value='delete'
                            <php>
                                if( strstr( $res['action'],'delete' ) ){
                                    echo 'checked';
                                }
                            </php>                                       
                                       />删除权限</li>
                        </ul>
                    </div>
                    <span class="required">*</span>
                    <div class="validate_msg_tiny">至少选择一个权限</div>
                </div>
                
                
                <div class="button_info clearfix">
                    <input type="button" value="保存" class="btn_save" onclick="send()" />
                    <input type="button" value="取消" class="btn_save" />
                </div>
            </form>
        </div>
        <!--主要区域结束-->

<script type="text/javascript">
    $(function(){
        //点击之后的图标
        $('.role_off').addClass('role_on').removeClass('role_off');
    });  
</script>
<script type="text/javascript">
//ajax提交
function send(){
            $.ajax({
                url: '__SELF__',
                type: 'post',
                dataType:'json',
                data: $(".main_form").serializeArray(),
                success: function(data) {
//                    console.log(data);
                    //判断是否修改成功！
                    if(data.status==0){
                        layer.msg(data.info,{icon: 5});
                    }else{
                        layer.msg(data.info,{icon: 6});
                        
                        //延迟跳转
                        setTimeout(function () {
                            location.href = "{:U('Privilege/index')}";
                        }, {:C('AJAX_TIME')});
                        
                        
                    }
                    
                }
            });

}    
</script>